package com.ansorgit.helpful.selectFavourite;

import com.ansorgit.helpful.AbstractEditorHandler;
import com.ansorgit.helpful.SearchDirection;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;

/**
 * User: jansorg
 * Date: Mar 5, 2010
 * Time: 5:30:47 PM
 */
public class SelectFavouriteHandler extends AbstractEditorHandler {
    public SelectFavouriteHandler() {
        super(false, SearchDirection.Backwards);
    }

    @Override
    protected void elementAction(Project project, PsiElement psiElement, Editor editor) {
        TextRange r = psiElement.getTextRange();
        editor.getSelectionModel().setSelection(r.getStartOffset(), r.getEndOffset());
    }
}
